
# Drop when listener spoke about options
listener_obs$listener_spoke_about_options

# Drop when speaker saw options / spoke about them
discuss_obs_choosing_only$participants_saw

discuss_obs_choosing_only$participants_spoke_about_option

# Drop when others can hear R2 answers
df %>% pull(others_could_hear_answers)

protocol_fidelity <- list(
  "Drop when others heard\noutcome-round answers\n(3-person discussion sample)" = feols_custom(
    r2_choose_trans ~ video_type_placebo + video_type_treatment + discussion_full + factor(stratum_id) + delivery_incentive_exp + item_diff + r2_reliability_diff * r2_reliability_shown ,
    data = r2_choices_num %>%
      filter(discuss_type %in% c("control", "discussion_full")) %>%
      filter(!is.na(r2_choose_trans)) %>%
      filter(others_could_hear_answers %in% c(F, NA)),
    fixef = c("stratum_id", "video_type", "delivery_incentive_exp", "comparator_order_in_pair", "phase"),
    cluster = "group_id",
    lasso = TRUE,
    lasso_options = list(
      potential_controls = control_vars,
      t = "discussion_full",
      interact = "pair_includes_trans",
      group_control = TRUE
    ),
  ),
  "Drop when listener spoke\n(Phase 2 sample)" = feols_custom(
    r2_choose_comparator ~ pair_includes_trans_alt + pair_includes_trans_alt*(video_type_placebo + video_type_treatment + public_observer + public_non_observer + discussion_pair_speaker + discussion_pair_listener + discussion_full + factor(stratum_id)) + item_diff + r2_reliability_diff * r2_reliability_shown ,
      data = r2_choices_num %>% filter(phase == "phase_2") %>%
        left_join(listener_obs %>%
                    select(group_id, listener_spoke_about_options) %>%
                    distinct(),
                  by = "group_id") %>%
        filter(!is.na(r2_choose_trans)) %>%
        tidylog::filter(listener_spoke_about_options %in% c(F, NA)),
    fixef = c("stratum_id", "video_type", "delivery_incentive_exp", "comparator_order_in_pair", "phase"),
    cluster = "group_id",
    lasso = TRUE,
    lasso_options = list(
      potential_controls = control_vars,
      t = "discussion_full",
      interact = "pair_includes_trans",
      group_control = TRUE
    ),
  ),
  "Drop when No-discussion (public)\nparticipants spoke\n(Phase 2 sample)" = feols_custom(
    r2_choose_comparator ~ pair_includes_trans_alt + pair_includes_trans_alt*(video_type_placebo + video_type_treatment + public_observer + public_non_observer + discussion_pair_speaker + discussion_pair_listener + discussion_full + factor(stratum_id)) + item_diff + r2_reliability_diff * r2_reliability_shown ,
    data = r2_choices_num %>% filter(phase == "phase_2") %>%
      left_join(discuss_obs_choosing_only %>%
                  select(group_id, participants_spoke_about_option) %>%
                  distinct(),
                by = "group_id") %>%
      filter(!is.na(r2_choose_trans)) %>%
      tidylog::filter(participants_spoke_about_option %in% c(F, NA)),
    fixef = c("stratum_id", "video_type", "delivery_incentive_exp", "comparator_order_in_pair", "phase"),
    cluster = "group_id",
    lasso = TRUE,
    lasso_options = list(
      potential_controls = control_vars,
      t = "discussion_full",
      interact = "pair_includes_trans",
      group_control = TRUE
    ),
  )
)

tex_export(
  protocol_fidelity,
  file = "outputs/tables/protocol_fidelity.tex",
  coef_rename = coef_label,
  gof_map = fe_label_no_fe,
  coef_omit = vars_to_regex(c("stratum_id", "Intercept", "video", "group_control", "pair_includes_trans_alt$", control_vars, "r2_reliability|item", "delivery")),
  stat_vec = "long",
  additional_header = vec_to_custom_header(c(" ", rep("Dep var: Chose trans in private outcome round (=1)", 3)))
)